Skip to content

Update MetaMask USD address to EIP-55 checksummed format in defaults.ts#8786

Merged
salimtb merged 4 commits into
mainfrom
fix/musd-checksummed
May 13, 2026
Merged

Update MetaMask USD address to EIP-55 checksummed format in defaults.ts#8786
salimtb merged 4 commits into
mainfrom
fix/musd-checksummed

Conversation

@salimtb
Copy link
Copy Markdown
Contributor

@salimtb salimtb commented May 13, 2026

This change ensures the mUSD address is consistently checksummed, preventing potential discrepancies in asset ID generation and data source emissions. The update is crucial for maintaining data integrity across different chains.

Explanation

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Changes the canonical casing of default CAIP-19 keys and makes getDefaultAssetMetadata case-sensitive, so any caller not normalizing asset IDs could stop receiving seeded metadata.

Overview
Fixes mUSD default asset IDs to use an EIP-55 checksummed contract address so the assetsInfo entries pre-seeded by buildDefaultAssetsInfo() match the checksummed IDs emitted by data sources, preventing duplicate metadata entries for the same token.

Updates defaults lookup behavior by keying DEFAULT_ASSET_METADATA by checksummed CAIP-19 IDs (removing .toLowerCase() normalization) and adds a regression test asserting seeded ERC-20 asset IDs contain checksum casing; changelog is updated accordingly.

Reviewed by Cursor Bugbot for commit d8eca2c. Bugbot is set up for automated code reviews on this repo. Configure here.

salimtb added 4 commits May 13, 2026 11:52
This change ensures the mUSD address is consistently checksummed, preventing potential discrepancies in asset ID generation and data source emissions. The update is crucial for maintaining data integrity across different chains.
…G.md

This change ensures the mUSD address is consistently checksummed, preventing discrepancies in asset ID generation and data source emissions. The update is crucial for maintaining data integrity across different chains.
This commit introduces a new test to ensure that the assetsInfo is pre-seeded with EIP-55 checksummed CAIP-19 keys. The test verifies that all ERC-20 asset IDs contain at least one uppercase hex letter, aligning with the expected output of the normalizeAssetId function. This change addresses a regression where the mUSD_ADDRESS was previously all-lowercase, leading to inconsistencies in asset ID generation.
This commit updates the DEFAULT_ASSET_METADATA to store checksummed CAIP-19 asset IDs instead of lowercase versions. It also modifies the getDefaultAssetMetadata function to require checksummed asset IDs for lookups, ensuring consistency and preventing potential issues with asset ID generation. This change aligns with recent tests and updates to maintain data integrity across different chains.
@salimtb salimtb marked this pull request as ready for review May 13, 2026 10:03
@salimtb salimtb requested review from a team as code owners May 13, 2026 10:03
@salimtb salimtb temporarily deployed to default-branch May 13, 2026 10:04 — with GitHub Actions Inactive
@salimtb salimtb added this pull request to the merge queue May 13, 2026
Merged via the queue into main with commit 5952f35 May 13, 2026
370 checks passed
@salimtb salimtb deleted the fix/musd-checksummed branch May 13, 2026 10:16
pull Bot pushed a commit to Reality2byte/metamask-extension that referenced this pull request May 14, 2026
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

patch assets controller 7.0.0

core PRs: 

- MetaMask/core#8789
- MetaMask/core#8781
- MetaMask/core#8786

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry:  patch assets controller 7.0.0

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.




<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Touches token/native balance normalization and default asset metadata
keying; mistakes could lead to incorrect balances or duplicate/missing
asset entries in state.
> 
> **Overview**
> Applies a Yarn patch override for `@metamask/assets-controller@7.0.0`
and updates the lockfile to use the patched package.
> 
> The patch tightens `RpcDataSource` balance conversion by validating
`decimals` and raw balances (defaulting invalid values to `"0"`), and
only reuses existing asset metadata when it has valid `decimals` (with a
helper to pick the first valid decimals source).
> 
> It also standardizes default/native asset identifiers: `mUSD` defaults
now use an EIP-55 checksummed address and `DEFAULT_ASSET_METADATA` keys
are stored/queried as checksummed CAIP-19 IDs (no `.toLowerCase()`), and
`buildNativeAssetsFromConstant` now runs IDs through `normalizeAssetId`.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
58b729d. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants